/***************************************************************************//**
 * @file GUI/GUI_MainWindow.h
 * @author  Marek M. Cel <marekcel@mscsim.org>
 *
 * @section LICENSE
 *
 * Copyright (C) 2013 Marek M. Cel
 *
 * This file is part of MScSim. You can redistribute and modify it under
 * the terms of GNU General Public License as published by the Free Software
 * Foundation; either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Further information about the GNU General Public License can also be found
 * on the world wide web at http://www.gnu.org.
 ******************************************************************************/
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

////////////////////////////////////////////////////////////////////////////////

#include <QMainWindow>
#include <QTimer>

#include "GUI_Data.h"

#include "DialogConf.h"
#include "DialogHelp.h"
#include "DialogInit.h"
#include "DialogMass.h"
#include "DialogType.h"

#ifdef MSCSIM_TEST
#   include "DialogTest.h"
#endif

#include "PaneData.h"
#include "PaneEFIS.h"
#include "PaneMain.h"

////////////////////////////////////////////////////////////////////////////////

namespace Ui
{
    class MainWindow;
}

////////////////////////////////////////////////////////////////////////////////

/** This is main window class. */
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:

    /** Constructor. */
    explicit MainWindow( QWidget *parent = 0 );

    /** Destructor. */
    virtual ~MainWindow();

    /** */
    void update( double timeStep, const GUI_DataInp &dataInp, GUI_DataOut &dataOut );

public slots:

    void on_actionAbout_triggered();
    void on_actionAboutQt_triggered();

    void on_actionDialogConf_triggered();
    void on_actionDialogEnvr_triggered();
    void on_actionDialogHelp_triggered();
    void on_actionDialogInit_triggered();
    void on_actionDialogMass_triggered();
    void on_actionDialogType_triggered();

#   ifdef MSCSIM_TEST
    void actionTestDialog_triggered();
#   endif

    void on_actionPaneData_triggered( bool checked );
    void on_actionPaneEFIS_triggered( bool checked );
    void on_actionPaneMain_triggered( bool checked );

    void on_actionInternalView_triggered();
    void on_actionExternalView_triggered();

    void on_actionFullScreen_triggered( bool checked );

    void on_actionQuit_triggered();
    
    void paneMain_pushInitDialogClicked();
    void paneMain_comboBoxType_currentIndexChanged();

protected:

    /** */
    void closeEvent( QCloseEvent *event );

private:

    Ui::MainWindow *m_ui;   ///< Qt UI object

    GUI_Data *m_data;

    DialogConf *m_dialogConf;   ///<
    DialogHelp *m_dialogHelp;   ///<
    DialogInit *m_dialogInit;   ///<
    DialogMass *m_dialogMass;   ///<
    DialogType *m_dialogType;   ///<

#   ifdef MSCSIM_TEST
    DialogTest *m_dialogTest;
#   endif

    PaneData *m_paneData;       ///<
    PaneEFIS *m_paneEFIS;       ///<
    PaneMain *m_paneMain;       ///<

    bool m_visiblePaneData;         ///<
    bool m_visiblePaneEFIS;         ///<
    bool m_visiblePaneMain;         ///<

    bool m_internalView;
    bool m_externalView;

    bool m_fullScreen;

    void updatePaneData();
    void updatePaneEFIS();
    void updatePaneMain();

    void setSideDockAreasFullHeight( bool left, bool rght );

    void settingsRead();
    void settingsWrite();
};

////////////////////////////////////////////////////////////////////////////////

#endif // MAIN_WINDOW_H
